/// 大整数库演示程序

/// 演示基本算术运算
fn demo_basic_arithmetic() -> Unit {
  println("=== 基本算术运算演示 ===")
  
  let a = BigInt::from_string("123456789012345678901234567890")
  let b = BigInt::from_string("987654321098765432109876543210")
  
  println("a = " + a.to_string())
  println("b = " + b.to_string())
  println("")
  
  println("a + b = " + (a + b).to_string())
  println("a - b = " + (a - b).to_string())
  println("a * b = " + (a * b).to_string())
  println("")
}

/// 演示比较运算
fn demo_comparison() -> Unit {
  println("=== 比较运算演示 ===")
  
  let big1 = @lib.BigInt::from_int(123456789)
  let big2 = @lib.BigInt::from_int(123456790)
  
  println("big1 = " + big1.to_string())
  println("big2 = " + big2.to_string())
  println("big1 == big2: " + (big1 == big2).to_string())
  println("big1 < big2: " + (big1 < big2).to_string())
  println("big1 > big2: " + (big1 > big2).to_string())
  println("")
}

/// 演示位运算
fn demo_bit_operations() -> Unit {
  println("=== 位运算演示 ===")
  
  let num = @lib.BigInt::from_int(12345)
  
  println("原数: " + num.to_string())
  println("左移5位: " + (num<<5).to_string())
  println("右移3位: " + (num>>3).to_string())
  println("是否为奇数: " + num.is_odd().to_string())
  println("是否为偶数: " + num.is_even().to_string())
  println("")
}

/// 主演示函数
pub fn demo() -> Unit {
  println("🎯 MoonBit 大整数库功能演示")
  println("==============================")
  println("")
  
  demo_basic_arithmetic()
  demo_comparison()
  demo_bit_operations()
  
  println("演示完成！")
}

